package com.ruoyi.personnel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.personnel.domain.ResearchAwards;
import com.ruoyi.personnel.mapper.ResearchAwardsMapper;
import com.ruoyi.personnel.service.IResearchAwardsService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 科研奖励Service业务层处理
 *
 * @author ruoyi
 * @date 2021-03-02
 */
@Service
public class ResearchAwardsServiceImpl extends ServiceImpl<ResearchAwardsMapper, ResearchAwards> implements IResearchAwardsService {

    @Override
    public List<ResearchAwards> queryList(ResearchAwards researchAwards) {
        LambdaQueryWrapper<ResearchAwards> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(researchAwards.getName())){
            lqw.like(ResearchAwards::getName ,researchAwards.getName());
        }
        if (StringUtils.isNotBlank(researchAwards.getJobNumber())){
            lqw.eq(ResearchAwards::getJobNumber ,researchAwards.getJobNumber());
        }
        if (StringUtils.isNotBlank(researchAwards.getPersonnelId())){
            lqw.eq(ResearchAwards::getPersonnelId ,researchAwards.getPersonnelId());
        }
        if (StringUtils.isNotBlank(researchAwards.getRewardName())){
            lqw.like(ResearchAwards::getRewardName ,researchAwards.getRewardName());
        }
        if (StringUtils.isNotBlank(researchAwards.getRewardLevel())){
            lqw.eq(ResearchAwards::getRewardLevel ,researchAwards.getRewardLevel());
        }
        if (StringUtils.isNotBlank(researchAwards.getAchievementName())){
            lqw.like(ResearchAwards::getAchievementName ,researchAwards.getAchievementName());
        }
        if (StringUtils.isNotBlank(researchAwards.getAwardDate())){
            lqw.eq(ResearchAwards::getAwardDate ,researchAwards.getAwardDate());
        }
        if (StringUtils.isNotBlank(researchAwards.getAwardLevel())){
            lqw.eq(ResearchAwards::getAwardLevel ,researchAwards.getAwardLevel());
        }
        if (StringUtils.isNotBlank(researchAwards.getUnitRanking())){
            lqw.eq(ResearchAwards::getUnitRanking ,researchAwards.getUnitRanking());
        }
        if (StringUtils.isNotBlank(researchAwards.getCertificateNo())){
            lqw.eq(ResearchAwards::getCertificateNo ,researchAwards.getCertificateNo());
        }
        if (StringUtils.isNotBlank(researchAwards.getEnclosure())){
            lqw.eq(ResearchAwards::getEnclosure ,researchAwards.getEnclosure());
        }
        if (StringUtils.isNotBlank(researchAwards.getEnclosureName())){
            lqw.like(ResearchAwards::getEnclosureName ,researchAwards.getEnclosureName());
        }
        if (StringUtils.isNotBlank(researchAwards.getStatus())){
            lqw.eq(ResearchAwards::getStatus ,researchAwards.getStatus());
        }
        return this.list(lqw);
    }
}
